//引入'mongoose'依赖
const mongoose = require('mongoose');

//连接数据库
mongoose.connect('mongodb://localhost/library');

//Schema数据结构
const userSchema = new mongoose.Schema({
  username: String,
  password: String
});

const bookSchema = new mongoose.Schema({
  logo: String,
  bookname: String,
  bookwriter: String,
  bookaomunt: Number
})

const readerSchema= new mongoose.Schema({
	readername: String,
	readerbookname:String,
	readerstatus:Boolean	
})	

//Model集合
const User = mongoose.model('user', userSchema);

const Book = mongoose.model('book', bookSchema);

const Reader = mongoose.model('reader', readerSchema);


module.exports = {
  User,
  Book,
  Reader
};